package com.yuchao.base.xyc004.strategy;

/**
 * Created by xingyuchao on 2017-06-25.
 * 环境角色
 */
public class Calculator {

    //持有一个具体策略的对象
    private CalculatorService calculatorService;

    //构造函数，传入一个具体策略对象
    public Calculator(CalculatorService calculatorService) {
        this.calculatorService = calculatorService;
    }
    //执行具体的策略方法
    public int execute(int num1, int num2){
        return calculatorService.doOperation(num1,num2);
    }
}